home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / util / rexx / FWAsynPrnt.lha / asynprnt.fwrx
Text File  |  1995-07-21  |  2KB  |  77 lines

  1. /*  AsyncPrint.fwrx
  2. **
  3. **  Brian Gragg   7/20/95
  4. **
  5. **  Script to print Asyncronously using FinalWriter.
  6. **  
  7. **  The script first asks then saves your file.  It then loads up another
  8. **  copy of the file, shrinks the new winow, and load the print requester.
  9. **  You can print or cancel, then the new window is closed.  You can edit
  10. **  The original while the print is taking place.
  11. **/
  12.  
  13. OPTIONS RESULTS
  14.  
  15. 'ShowMessage 1 0 "Asyncronous Printing:" 
  16.                  "  This will save the file to the name shown in" 
  17.                  "  the titlebar or it will ask if no name is defined." 
  18.                  "Okay" "Cancel" ""'
  19. IF RESULT ~= 1 THEN EXIT 
  20.  
  21. /* save the file first, to the default name or ask FOR one */
  22. 'Save'
  23.  
  24. /* get the portname for the original document */
  25. 'Status PortName'
  26. originalPort = RESULT 
  27.  
  28. /* get the filename that is was saved as */
  29. 'Status PathName'
  30. file = RESULT
  31.  
  32. /*****************************************************************************/
  33. /* The Next block of code is needed to determine the portname of the window that
  34.    was just opened.  Softwood should fix this one!! */
  35. olist = Show('P',,'\')
  36. fwlist = ''
  37. DO UNTIL olist=''
  38.     PARSE VAR olist name '\' olist
  39.     IF Left(name,7)="FINALW." THEN fwlist = fwlist || ' ' || name
  40.     END
  41.     
  42. /* open a secod copy of the document */
  43. 'Open ' file
  44.  
  45. portname = ""
  46.  
  47. DO UNTIL (portname ~= "" | loops = 10)
  48.     /* Since Open returns before the port is ready, we need to wait a second */
  49.     CALL Delay(50)
  50.  
  51.     nlist = Show('P',,'\')
  52.     portname = ''
  53.     DO UNTIL portname~='' | nlist=''
  54.         PARSE VAR nlist name '\' nlist
  55.         IF Left(name,7)="FINALW." THEN
  56.             IF 0=Find(fwlist,name) THEN portname=name
  57.         END
  58. END 
  59.  
  60. IF portname='' THEN 
  61.     DO
  62.     'ShowMessage 1 1 "Error finding the" "ARexx Port name" "" "OK" "" ""'
  63.     EXIT 0
  64.     END
  65.  
  66. /******* okay, we've got the new portname now, lets switch to it **********/
  67. ADDRESS Value portname
  68.  
  69. /* make it small and out of the way */
  70. 'ChangeWindow 0 0 160 101'
  71.  
  72. /* bring up the print requester , It's up to you to toggle back to the
  73.    original document to edit it*/
  74. 'Print PROMPT'
  75.  
  76. 'Close FORCE'
  77.